{extend name="public/layout" /}
{block name="head"}{/block}
{block name="body"}
<body>
<div class="container-fluid p-t-15">
    <div class="card">
        <div class="card-header">
            <h4>[{$info.table_name}]修改字段</h4>
        </div>
        <div class="card-body">
            <form class="form-horizontal" id="form" data-url="/system/cms.table/index.html?table_name={$info.table_name}">
                <div class="form-group">
                    <label class="col-sm-2 col- control-label">标签名</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_text('label_name',$info.label_name,[
                        "datatype"=>"*",
                        "nullmsg"=>"请填写标签名",
                        ])}
                    </div>
                    <label class="col-sm-2 control-label">默认值</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_text('default_value',$info.default_value)}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">字段名</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_text('field_name',$info.field_name,[
                        "disabled",
                        "datatype"=>"*"
                        ])}
                    </div>
                    <label class="col-sm-2 control-label">字段类型</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_select('field_type',$info.field_type,[
                        "disabled",
                        "datatype"=>"*",
                        "items-data"=>$field_types,
                        "items-key"=>"key",
                        "items-name"=>"name",
                        ])}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">控件类型</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_select('obj_type',$info.obj_type,[
                        "datatype"=>"*",
                        "items-data"=>$obj_types,
                        "items-key"=>"key",
                        "items-name"=>"name",
                        ])}
                    </div>
                    <label class="col-sm-2 control-label">字段长度</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_text('field_length',$info.field_length,[
                        "disabled"
                        ])}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">控件位置</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_radio('obj_location',$info.obj_location,[
                        "datatype"=>"*",
                        "items-data"=>[
                            ["key"=>1,"name"=>"左"],
                            ["key"=>2,"name"=>"右"],
                        ],
                        "items-key"=>"key",
                        "items-name"=>"name",
                        ])}
                    </div>
                    <label class="col-sm-2 control-label">排序</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_number('show_order',$info.show_order,[
                        "datatype"=>"*"
                        ])}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">后端验证</label>
                    <div class="col-sm-8">
                        {:\\helper\\Form::_text('obj_valid',$info.obj_valid)}
                        <p class="help-block">
                            后端验证规格格式:"require|number|between:1,120",
                            添加编辑验证规则不一致时用###隔开。
                            <a href="javascript:void(0)" onclick="doAction.valid('tp6')">tp内置验证规格</a>
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">控件配置</label>
                    <div class="col-sm-8 form-control-static">
                        {:\\helper\\Form::_ace('obj_options',$info.obj_options,[
                        "data-theme"=>"tomorrow_night_eighties",
                        "data-mode"=>"json",
                        "style"=>"height:220px"
                        ])}
                        <p class="help-block">
                            前端验证使用validform,键名datatype,为空键名:nullmsg,错误键名:errmsg。
                            <a href="javascript:void(0)" onclick="doAction.valid('validform')">验证规则</a>
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">提示文字</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_text('obj_tips',$info.obj_tips)}
                    </div>
                    <label class="col-sm-2 control-label">控件状态</label>
                    <div class="col-sm-3">
                        {:\\helper\\Form::_switch('obj_status',$info.obj_status)}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <div class="pull-left">
                            <button type="button" class="btn btn-primary btn-sub"><i class="mdi mdi-content-save"></i> 保存</button>
                            <button type="button" class="btn btn-danger" onclick="helper.closeCurrent()"><i class="mdi mdi-close"></i> 关闭</button>
                        </div>
                        <div class="pull-left m-l-15">
                            <p class="error-msg"></p>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{include file="cms/field/valid" /}
<script>
    formHelper.init();
    formHelper.subForm();
    var doAction={
        valid:function (type) {
            var title = type=='validform' ? '前端验证规则' : '后端验证规则';
            var html = juicer($('#'+type+'-tpl').html(),{});
            layer.open({
                type: 1,
                title: title,
                area: ['680px', '400px'],
                content: html
            });
        }
    };
</script>
</body>
{/block}